import request from '@/utils/request'

// 获取首页今日上新数据
export function getNewListApi() {
  return request.get('vehicle/getNew')
}

// 获取分类页数据
export function getCategoryPageDataApi(id) {
  return request.get(`vehicle/getCategoryData/${id}`)
}

// 获取list页数据
export function listByConditionApi(data) {
  return request({
    url: 'vehicle/listByCondition',
    method: 'post',
    data
  })
}

// 获取车辆详情，渲染details页和修改车辆页
export function getVehicleDetailsApi(id) {
  return request.get(`/vehicle/browse/${id}`)
}

// 添加车辆
export function addVehicle(data) {
  return request({
    url: '/vehicle/add2',
    method: 'post',
    data
  })
}

// 修改车辆
export function modifyVehicleApi(data) {
  return request({
    url: '/vehicle/modify',
    method: 'put',
    data
  })
}

// 删除车辆
export function deleteVehicleApi(id) {
  return request({
    url: `/vehicle/delete/${id}`,
    method: 'delete'
  })
}

// 获取用户发布的车辆列表
export function getPublishApi(params) {
  return request({
    url: '/vehicle/publishes',
    params
  })
}

// 提交审核
export function commitAuditApi(id) {
  return request({
    url: `/audit/commitAudit/${id}`,
    method: 'put'
  })
}
